﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MicroTest
{
    public partial class BindLable : UserControl
    {
        private string labelPenSerial;
        private string labelStudentName;
        private bool isBind = false;
        public delegate void MenuEventHandler(object sender, MenuEventArgs arg);
        public event MenuEventHandler OnMenuEvent;
        public BindLable(string penSerial)
        {
            InitializeComponent();
            labelPenSerial = penSerial;
            labName.Text = penSerial;
        }
        public bool IsBind()
        {
            return isBind;
        }
        public void BindStudent(string studentName)
        {
            labName.Text = studentName;
            labelStudentName = studentName;
            panStatus.BackColor = Color.LightGreen;
            isBind = true;
        }
        public string GetPenSerial()
        {
            return labelPenSerial;
        }
        public string GetStudentName()
        {
            return labelStudentName;
        }
        public void SetPenSerial(string penSerial)
        {
            labelPenSerial = penSerial;
        }

        private void panStatus_MouseUp(object sender, MouseEventArgs e)
        {
            base.OnMouseUp(e);
        }

        private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(OnMenuEvent!=null)
            {
                OnMenuEvent(this, new MenuEventArgs());
            }
        }
    }
    public class MenuEventArgs : EventArgs
    {

    }

}
